package com.server.http.handler;


import com.server.conditionenum.HttpReturnStatus;
import com.server.http.handler.domain.JsonUtil;
import com.server.http.handler.domain.ReturnEntity;
import com.server.http.request.HttpRequestMessage;
import com.server.http.response.HttpResponseMessage;

public abstract class HttpHandler {
	public abstract void handle(HttpRequestMessage request,HttpResponseMessage response); 
	
	public void SetReturnData(HttpResponseMessage response,Object data,int type,HttpReturnStatus status){
		ReturnEntity ret = ReturnEntity.HttpReturn(data,type,status);
		response.appendBody(JsonUtil.ObjectToJsonString(ret));
		response.setResponseCode(HttpResponseMessage.HTTP_STATUS_SUCCESS);
	}
	
	/*public void SetFail(HttpResponseMessage response,String msg){
		ReturnEntity ret = ReturnEntity.createFail(msg,0);
		response.appendBody(JsonUtil.ObjectToJsonString(ret));
		response.setResponseCode(HttpResponseMessage.HTTP_STATUS_SUCCESS);
	}*/
}
